<?php
	require_once "weixin_info.php";
	require_once "config.php";
	$deta_sql = $mysql->query('select * from dyspw_shop_detailed where u_id = '.$_SESSION['Member_info'][0]['id'].' or branch_store_id = '.$_SESSION['Member_info'][0]['id'].' ORDER BY id DESC');
	$deta = $deta_sql->fetch_all(MYSQLI_ASSOC);
 ?>
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0,viewport-fit=cover">
    <title>收支明细</title>
    <!-- 引入组件库 -->
    <link rel="stylesheet" href="./lib-Jin/vant-index.css">
    <script src="./lib-Jin/vue.min.js"></script>
    <script src="./lib-Jin/vant-index.js"></script>
    <link rel="stylesheet" href="./lib-Jin/all.css">
    <link rel="stylesheet" href="./css/mingxi.css">
</head>
<body>
    <div id="app">
        <div class="top">
            <div class="back">
                <img src="./images/back1.png">
            </div>
            收支明细
        </div>
        <!-- <div class="shou-info">
            <div style="display: flex;align-items: center;">
                <div @click="showRiLi" style="font-size: .36rem;color: #2f2725;margin-right: .23rem;font-weight: bold;">本月</div>
                <img src="./images/down.png" style="width: .17rem;height: .08rem;" @click="showRiLi">
                <van-calendar v-model="show" type="range" @confirm="onConfirm"></van-calendar>
            </div>
            <div class="shou-money-info">
                <div style="margin-right: .8rem;">支出：2503.04</div>
                <div>收入：2503.04</div>
            </div>
        </div> -->
        <div class="shou-list">
			<?php foreach ($deta as $key => $val) { ?>
				<div class="list-log">
					<div style="display: flex;">
						<?php if($val['type'] == 1){ ?>
							<img src="./images/shou1.png" style="width: .7rem;height: .55rem;margin-right: .3rem;">
						<?php }else{ ?>
							<img src="./images/shou2.png" style="width: .7rem;height: .55rem;margin-right: .3rem;">
						<?php } ?>
						<div>
							<div style="font-size: .36rem; color: #2f2725;letter-spacing: 2px;font-weight: bold;">
								<?php if($val['type'] == 1){ ?>
									<a href="shouru.php?id=<?php echo $val['id'] ?>">
										<div style="font-size: .36rem; color: #2f2725;letter-spacing: 2px;font-weight: bold;"><?php echo $val['u_name']; ?></div>
										<div style="font-size: .26rem; color: #595757;margin: .3rem 0;letter-spacing: 2px;"><?php echo $val['goods_name'] ?></div>
										<div style="font-size: .24rem; color: #595757;"><?php echo date('Y-m-d H:i:s', $val['hexiao_time']); ?></div>
									</a>
								<?php }else{ ?>
									<a href="tixian.php?id=<?php echo $val['id'] ?>">
										<div style="font-size: .36rem; color: #2f2725;letter-spacing: 2px;font-weight: bold;">提现</div>
										<div style="font-size: .26rem; color: #595757;margin: .3rem 0;letter-spacing: 2px;">提现至银行卡</div>
										<div style="font-size: .24rem; color: #595757;"><?php echo date('Y-m-d H:i:s', $val['case_time']); ?></div>
									</a>
								<?php } ?>
							</div>
						</div>
					</div>
					<?php if($val['type'] == 1){ ?>
						<div style="font-size: .36rem;color: #405ed8;font-weight: bold;">+<?php echo $val['income_money'] ?></div>
					<?php }else{ ?>
						<div style="font-size: .36rem;color: #2f2725;font-weight: bold;">-<?php echo $val['cash_money']; ?></div>
					<?php } ?>
				</div>
			<?php } ?>
        </div>
    </div>
</body>
</html>
<script>
    new Vue({
        el:"#app",
        data:{
            date: '',
            show: false
        },
        methods: {
            back(){
                window.history.back()
            },
            showRiLi(){
                this.show = true
            },
            formatDate(date) {
                return `${date.getFullYear()}/${date.getMonth() + 1}/${date.getDate()}`;
            },
            onConfirm(date) {
                const [start, end] = date;
                this.show = false;
                this.date = `${this.formatDate(start)} - ${this.formatDate(end)}`;
                console.log(this.date)
            },
        },
        mounted () {
            // console.log(this.show)
        }
    })

    Vue.use(
        vant.Calendar
    );
</script>
<script>
    (function (doc, win) {
    var docEl = doc.documentElement,
        resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
        recalc = function () {
        var clientWidth = docEl.clientWidth
        if (!clientWidth) return
        if (clientWidth >= 750) {
            docEl.style.fontSize = '100px'
        } else {
            docEl.style.fontSize = 100 * (clientWidth / 750) + 'px'
        }
        }
    if (!doc.addEventListener) return
    win.addEventListener(resizeEvt, recalc, false)
    doc.addEventListener('DOMContentLoaded', recalc, false)
    })(document, window)
</script>
